package com.spareparts.protocol;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.spareparts.entyties.JuDian;
import com.spareparts.entyties.WuLiao;

import cm.framework.protocol.BaseJSONRsponse;

public class WuLiaoResponse extends BaseJSONRsponse 
{
	public List<WuLiao> mWuLiao = new ArrayList<WuLiao>();
	
	@Override
	protected boolean extractBody(JSONObject arg0) 
	{
		try 
		{
			JSONArray dataJsonArray = arg0.getJSONArray("res");
			if ( dataJsonArray != null && dataJsonArray.length()>0)
			{
				WuLiao oWuLiao1 = new WuLiao();
				oWuLiao1.id = "";
				oWuLiao1.code = "";
				mWuLiao.add(oWuLiao1);
				for(int i=0;i<dataJsonArray.length();i++)
				{
					WuLiao oWuLiao = new WuLiao();
					JSONObject jsonObj = dataJsonArray.getJSONObject(i);
					oWuLiao.id = jsonObj.getString("id");
					oWuLiao.code = jsonObj.getString("code");
					mWuLiao.add(oWuLiao);
				}
			}
		}
		catch (JSONException e)
		{
			e.printStackTrace();
		}
		return true;
	}

}
